package com.cos.lession73.slice;

import com.cos.lession73.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Button;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class DbclickAbilitySlice extends AbilitySlice {

    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        setUIContent(ResourceTable.Layout_ability_dbclick);

        Button btn1 = (Button) findComponentById(ResourceTable.Id_btn1);
        //单击事件
        //btn1.setClickedListener();
        //双击事件  dbclick
        btn1.setDoubleClickedListener(new Component.DoubleClickedListener() {
            @Override
            public void onDoubleClick(Component component) {
                Text t = (Text) findComponentById(ResourceTable.Id_cbclick_text);
                t.setText("被双击了");
            }
        });
    }
}
